﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ConstantCMapEditor3
{
    public partial class RenameForm : Form
    {
        public String DefaultName;
        public String ResultName;


        public RenameForm()
        {
            InitializeComponent();
        }

        private void RenameForm_Load(object sender, EventArgs e)
        {
            this.textBox1.Text = DefaultName;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            foreach (Declaration d in Game1.declarationList) 
            {
                if (d.ClassID == this.textBox1.Text) 
                {
                    MessageBox.Show(this.textBox1.Text+"已經存在!");
                    return;
                }
            }

            ResultName = this.textBox1.Text;
            Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            ResultName = DefaultName;
            Close();
        }

    }
}
